{template header.html}
<script type="text/javascript">
function dr_confirm_move() {
	art.dialog.confirm("{lang('015')}", function(){
		$('#action').val('move');
		var _data = $("#myform").serialize();
		var _url = window.location.href;
		if ((_data.split('ids')).length-1 <= 0) {
			$.dialog.tips(lang['select_null'], 2);
			return true;
		}
		// 将表单数据ajax提交验证
		$.ajax({type: "POST",dataType:"json", url: _url, data: _data,
			success: function(data) {
				//验证成功
				if (data.status == 1) {
					$.dialog.tips(data.code, 3, 1);
					$("input[name='ids[]']:checkbox:checked").each(function(){
						$.post("{SITE_URL}{APP_DIR}/index.php?c=show&m=create_html&id="+$(this).val(), {}, function(){});
					});
                    $.post("{SITE_URL}{APP_DIR}/index.php?c=home&m=create_list_html&id="+$('#move_id').val(), {}, function(){});
					setTimeout('window.location.reload(true)', 3000); // 刷新页
				} else {
					$.dialog.tips(data.code, 3, 2);
					return true;
				}
			},
			error: function(HttpRequest, ajaxOptions, thrownError) {
				alert(HttpRequest.responseText);
			}
		});
		return true;
	});
	return false;
}
function dr_status(id, v) {
	var title = "";
	if (v == 9) {
		title = "<font color=red><b>{lang('mod-504')}</b></font>";
	} else {
		title = "<font color=blue><b>{lang('mod-505')}</b></font>";
	}
	art.dialog.confirm(title, function(){
		// 将表单数据ajax提交验证
		$.ajax({type: "POST",dataType:"json", url: "{dr_url(APP_DIR.'/home/status')}&id="+id+"&v="+v, success: function(data) {
				//验证成功
				if (data.status == 1) {
					$.dialog.tips(data.code, 3, 1);
					if (data.id) {
						$.post("{SITE_URL}{APP_DIR}/index.php?c=show&m=create_html&id="+id, {}, function(){});
						$.post("{SITE_URL}{APP_DIR}/index.php?c=home&m=create_list_html&id="+data.id, {}, function(){});
					}
					setTimeout('window.location.reload(true)', 3000); // 刷新页
				} else {
					$.dialog.tips(data.code);
				}
			},
			error: function(HttpRequest, ajaxOptions, thrownError) {
				alert(HttpRequest.responseText);
			}
		});
		return true;
	});
	return false;
}
function dr_ts() {
    var v = $("#myform").serialize();
    if ((v.split('ids')).length-1 <= 0) {
        $.dialog.tips(lang['select_null'], 2);
        return true;
    }
    var url = "{dr_url(APP_DIR.'/home/ts_ajax')}";
    art.dialog.open(url, { title: '{lang("html-266")}',
        ok: function () {
            var iframe = this.iframe.contentWindow;
            if (!iframe.document.body) {
                alert('iframe loading')
                return false;
            };
            var tab = iframe.$('#dr_tab').val();
            url+='&ispost=1&tab='+tab;
            if (tab == 1) {
                // 推荐位
                var id = iframe.document.getElementsByName('dr_flag');
                var value = new Array();
                for (var i = 0; i < id.length; i++){
                    if (id[i].checked) {
                        value.push(id[i].value);
                    }
                }
                $.ajax({type: "POST", url:url+'&value='+value, data:v, dataType:'json', success: function (data) {
                    if (data.status == 1) {
                        dr_tips(data.code, 3, 1);
                        setTimeout('window.location.reload(true)', 3000); // 刷新页
                    } else {
                        dr_tips(data.code);
                    }
                }});
            } else if (tab == 2) {
                alert('功能尚未开发');
            } else if (tab == 0) {
                var o = iframe.document.getElementById("dr_synid");  
				  var str = "";  
				  for(i=0;i<o.length;i++){     
					if(o.options[i].selected){  
						str+=o.options[i].value+",";  
					}  
				}  
				$.ajax({type: "POST", url:url+'&value='+str, data:v, dataType:'json', success: function (data) {
                    if (data.status == 1) {
                        dr_tips(data.code, 3, 1);
                        setTimeout('window.location.reload(true)', 3000); // 刷新页
                    } else {
                        dr_tips(data.code);
                    }
                }});
            }
            return true;
        },
        cancel: true
    });
    return;
}
</script>
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		{$menu}
	</div>
	<div class="bk10"></div>
	<div class="explain-col">
		{if $flag}
		<font color="gray">{lang('html-490')}</font>
		{else}
        <form method="post" action="" name="searchform" id="searchform">
		<input name="search" id="search" type="hidden" value="1" />
		{$select2}
		&nbsp;
		<select name="data[field]">
			<option value="id" {if $param.field=='id'}selected{/if}>Id</option>
			{loop $field $t}
			{if $t.ismain}
			<option value="{$t.fieldname}" {if $param.field==$t.fieldname}selected{/if}>{$t.name}</option>
			{/if}
			{/loop}
		</select> ：
		<input type="text" class="input-text" value="{$param.keyword}" size="30" placeholder="{lang('html-249')}" name="data[keyword]" />&nbsp;
		{lang('105')} ：
		{dr_field_input('start', 'Date', array('option'=>array('format'=>'Y-m-d','width'=>80)), (int)$param.start)}
		-&nbsp;
		{dr_field_input('end', 'Date', array('option'=>array('format'=>'Y-m-d','width'=>80)), (int)$param.end)}
		&nbsp;
		<input type="submit" value="{lang('search')}" class="button" name="search" />
		</form>
		{/if}
	</div>
	<div class="bk10"></div>
	<div class="table-list">
		<form action="" method="post" name="myform" id="myform">
        <input name="action" id="action" type="hidden" value="" />
		<table width="100%">
		<thead>
		<tr>
			<th width="20" align="right"><input name="dr_select" id="dr_select" type="checkbox" onClick="dr_selected()" />&nbsp;</th>
			<th width="30" align="center">{lang('order')}</th>
			<th hide="1" class="{ns_sorting('id')}" name="id" width="50" align="center">Id</th>
			<th class="{ns_sorting('title')}" name="title" align="left">&nbsp;{lang('mod-35')}</th>
			<th class="{ns_sorting('catid')}" name="catid" width="100" align="center">{lang('cat-00')}</th>
			<th hide="1" class="{ns_sorting('author')}" name="author" width="80" align="center">{lang('101')}</th>
			<th class="{ns_sorting('updatetime')}" name="updatetime" width="120" align="left">{lang('105')}</th>
			<th class="{ns_sorting('status')}" name="status" width="40" align="center">{lang('mod-500')}</th>
			<th align="left" class="dr_option">{lang('option')}</th>
		</tr>
		</thead>
		<tbody>
		{loop $list $t}
		<tr class="dr_row_hide" id="dr_row_{$t.id}">
			<td align="right"><input name="ids[]" type="checkbox" class="dr_select" value="{$t.id}" />&nbsp;</td>
			<td align="center"><input class="input-text displayorder" type="text" name="data[{$t.id}][displayorder]" value="{$t.displayorder}" /></td>
			<td hide="1" align="center" class="sorting2">{$t.id}</td>
			<td align="left" class="sorting2"><a title="{$t.title}" class="onloading" href="{dr_url(APP_DIR.'/home/edit',array('id'=>$t.id))}">{if $t.thumb}<img src="/dayrui/statics/images/img.png" align="absmiddle" height="18" width="15">&nbsp;{/if}{dr_keyword_highlight(dr_strcut($t.title, 40), $param.keyword)}{if $t.link_id >0}<img align="absmiddle" src="/dayrui/statics/images/link2.png">{/if}</a></td>
			<td align="center" class="sorting2"><a href="{if $flag}{dr_url(APP_DIR.'/home/index', array('flag'=>$flag,'catid'=>$t.catid))}{else}{dr_url(APP_DIR.'/home/index', array('catid'=>$t.catid))}{/if}">{CATEGORY.$t[catid].name}</a></td>
			<td hide="1" align="center" class="sorting2"><a href="javascript:;" onclick="dr_dialog_member('{$t.uid}')">{dr_strcut($t.author, 10)}</a></td>
			<td align="left" class="sorting2">{dr_date($t.updatetime, NULL, 'red')}</td>
			<td align="center" class="sorting2">{if $t.status == 9}<a class="alist" href="javascript:dr_status({$t.id}, '{$t.status}');">{lang('mod-501')}</a>{else}<a class="adel" href="javascript:dr_status({$t.id}, '{$t.status}');">{lang('mod-502')}</a>{/if}</td>
			<td align="left" class="dr_option">
            <div class="drmenu clist-menu">
            <ul>
			<li><a class="ago" href="{if $t.status == 9}{$t.url}{else}{APP_DIR}/index.php?c=show&id={$t.id}{/if}" target="_blank">{lang('go')}</a></li>
			{if $this->ci->is_auth(APP_DIR.'/admin/home/edit')}
            <li><a class="aedit onloading" href="{dr_url(APP_DIR.'/home/edit',array('id'=>$t.id))}">{lang('edit')}</a></li>
            {/if}
            {if $extend}
            <li><a class="alist onloading" href="{dr_url(APP_DIR.'/extend/index',array('cid'=>$t.id,'catid'=>$get.catid))}" style="color:#00F">{lang('mod-29')}</a></li>
            {/if}
            {if $app}
            <li>
            <a class="alist hide" href="javascript:;">{lang('html-792')}</a>
            <ul>
			{loop $app $a}
            <li><a class="onloading" href="{$a.url}&cid={$t.id}&catid={$t.catid}&module={APP_DIR}">{$a.name}{if $a.field!='null'}（{intval($t[$a.field])}）{/if}</a></li>
            {/loop}
            </ul>
            {/if}
            {if $form}
            <li>
            <a class="alist hide" href="javascript:;">{lang('html-663')}</a>
            <ul>
			{loop $form $a}
            <li><a class="onloading" href="{$a.url}&cid={$t.id}">{$a.name}（{intval($t[$a['field']])}）</a></li>
            {/loop}
            </ul>
            </li>
            {/if}
            </ul>
            </div>
            </td>
		</tr>
		{/loop}
		<tr>
			<th width="20" align="right"><input name="dr_select" id="dr_select" type="checkbox" onClick="dr_selected()" />&nbsp;</th>
			<td colspan="8" align="left" style="border:none">
			{if !$get.flag}
                {if $this->ci->is_auth(APP_DIR.'/admin/home/del')}<input type="button" class="button" value="{lang('del')}" name="option" onClick="$('#action').val('del');dr_confirm_set_all('{lang('015')}')" />{/if}
            {else}
                {if $this->ci->is_auth(APP_DIR.'/admin/home/edit')}<input type="button" class="button" value="{lang('081')}" name="option" onClick="$('#action').val('flag');dr_confirm_set_all('{lang('015')}')" />{/if}
            {/if}
            {if $this->ci->is_auth(APP_DIR.'/admin/home/edit')}
			<input type="button" class="button" value="{lang('order')}" name="option" onClick="$('#action').val('order');dr_confirm_set_all('{lang('015')}')" />
			<input type="button" class="button" value="{lang('html-265')}" name="option" onClick="dr_confirm_move();" />
			{$select}
			&nbsp;&nbsp;
			<input type="button" class="button" value="{lang('html-266')}" name="option" onClick="dr_ts()" />
			{/if}
            {if $this->ci->is_auth(APP_DIR.'/admin/home/html') && MODULE_HTML}
            <input type="submit" class="button" value="{lang('html-621')}" name="option" onClick="$('#action').val('html');" />
            {/if}
			</td>
		</tr>
		</tbody>
		</table>
		</form>
        <div id="pages"><a>{dr_lang('html-346', $param.total)}</a>{$pages}</div>
	</div>
</div>
{template footer.html}